package com.ft.sso.secrityauthor2sso.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;

/**
 * @Author RenPu
 * @Date 2022/9/28 15:13
 * @Version 1.0
 * @Description: redis的配置
 **/

@Configuration
public class RedisConfig {

    @Autowired
    private RedisConnectionFactory redisConnectionFactory;

    /**
     * 将连接工厂交给RedisTokenStore，进行将token存储到redis
     * @return
     */
    @Bean
     public TokenStore getTokenStore(){
         return new RedisTokenStore(redisConnectionFactory);
     }

}
